//
//  LeagueRankViewCell.m
//  LiveSoftware
//
//  Created by lanou3g on 15/7/15.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//
//杯赛排名
#import "LeagueRankViewCell.h"
#import "LeagueScoreScoreModel.h"

@interface LeagueRankViewCell ()

@property(nonatomic,strong)UIView *titleView;

/**
 *排名
 */
@property(nonatomic,strong)UILabel*rankLabel;



/**
 *球队
 */
@property(nonatomic,strong)UILabel*teamLabel;


/**
 *总
 */
@property(nonatomic,strong)UILabel*totalLabel;


/**
 *胜
 */
@property(nonatomic,strong)UILabel *winLabel;


/**
 *平
 */
@property(nonatomic,strong)UILabel*drawLabel;




/**
 *负
 */
@property(nonatomic,strong)UILabel*lossLabel;





/**
 *得
 */
@property(nonatomic,strong)UILabel*getLabel;


/**
 *失
 */
@property(nonatomic,strong)UILabel *missLabel;


/**
 *净
 */
@property(nonatomic,strong)UILabel*cleanLabel;
/**
 *积分
 */
@property(nonatomic,strong)UILabel*scoreLabel;



@end


@implementation LeagueRankViewCell



-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        
        float partX =kScreenIp6(0);
        float partY = 0;//开始高度
        float teamWidth = kScreenIp6(90);
        float partWidth = (kScreenWidth - kScreenIp6(90) - kScreenIp6(20)) / 9;
        float partHeight = 35;
        
        
        
        self.titleView =[ [UIView alloc]initWithFrame:CGRectMake(kScreenIp6(5), partY, kScreenWidth, partHeight)];
        
        [self.contentView addSubview:_titleView];
        
        
        
        
        //排名
        self.rankLabel = [[UILabel alloc]initWithFrame:CGRectMake(partX, partY, partWidth, partHeight)];
        self.rankLabel.font = [UIFont systemFontOfSize:12];
        self.rankLabel.textAlignment = NSTextAlignmentCenter;
        self.rankLabel.text = @"排名";
        
        [self.titleView addSubview:_rankLabel];
        
        
        //球队
        self.teamLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.rankLabel.frame) + kScreenIp6(5), partY, teamWidth , partHeight)];
        self.teamLabel.font = [UIFont systemFontOfSize:12];
        self.teamLabel.textAlignment = NSTextAlignmentCenter;
        self.teamLabel.adjustsFontSizeToFitWidth = YES;
        self.teamLabel.text = @"球队";
        
        [self.titleView addSubview:_teamLabel];
        
        
        //总
        self.totalLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.teamLabel.frame) + kScreenIp6(5), partY,  partWidth, partHeight)];
        self.totalLabel.font = [UIFont systemFontOfSize:12];
        self.totalLabel.textAlignment = NSTextAlignmentCenter;
        self.totalLabel.text = @"总";
        
        [self.titleView addSubview:_totalLabel];
        
        
        //胜
        self.winLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.totalLabel.frame), partY,  partWidth, partHeight)];
        self.winLabel.font = [UIFont systemFontOfSize:12];
        self.winLabel.textAlignment = NSTextAlignmentCenter;
        self.winLabel.text = @"胜";
        
        [self.titleView addSubview:_winLabel];
        
        
        //平
        self.drawLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.winLabel.frame), partY, partWidth,partHeight)];
        self.drawLabel.font = [UIFont systemFontOfSize:12];
        self.drawLabel.textAlignment = NSTextAlignmentCenter;
        self.drawLabel.text = @"平";
        
        [self.titleView addSubview:_drawLabel];
        
        
        
        
        //负
        self.lossLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.drawLabel.frame), partY, partWidth, partHeight)];
        self.lossLabel.font = [UIFont systemFontOfSize:12];
        self.lossLabel.textAlignment = NSTextAlignmentCenter;
        self.lossLabel.text = @"负";
        
        [self.titleView addSubview:_lossLabel];
        
        
        
        //得
        self.getLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.lossLabel.frame), partY, partWidth, partHeight)];
        self.getLabel.font = [UIFont systemFontOfSize:12];
        self.getLabel.textAlignment = NSTextAlignmentCenter;
        self.getLabel.text = @"得";
        
        [self.titleView addSubview:_getLabel];
        
        
        
        
        //失
        self.missLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.getLabel.frame), partY, partWidth, partHeight)];
        self.missLabel.font = [UIFont systemFontOfSize:12];
        self.missLabel.textAlignment = NSTextAlignmentCenter;
        self.missLabel.text = @"失";
        
        [self.titleView addSubview:_missLabel];
        
        
        //净
        self.cleanLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.missLabel.frame), partY, partWidth, partHeight)];
        self.cleanLabel.font = [UIFont systemFontOfSize:12];
        self.cleanLabel.textAlignment = NSTextAlignmentCenter;
        self.cleanLabel.text = @"净";
        
        [self.titleView addSubview:_cleanLabel];
        
        
        
        
        //积分
        self.scoreLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.cleanLabel.frame), partY, partWidth, partHeight)];
        self.scoreLabel.font = [UIFont systemFontOfSize:12];
        self.scoreLabel.textAlignment = NSTextAlignmentCenter;
        self.scoreLabel.text = @"积分";
        
        [self.titleView addSubview:_scoreLabel];
        
        
        
        //线
        UIView *footLineView = [[UIView  alloc]initWithFrame:CGRectMake( 0, partHeight, kScreenWidth, 0.5)];
        
        footLineView.backgroundColor = [UIColor colorWithWhite:0.699 alpha:1.000];
        
        [self.titleView addSubview:footLineView];
        
        
        
        
        // 设置 cell 点击没有变化
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
    }
    
    return self;
    
}

-(void)setCellValue:(LeagueScoreScoreModel*)model
{
    
    /**
     *排名
     */
    self.rankLabel.text = model.rank;
    
    
    
    
    /**
     *球队
     */
    self.teamLabel.text = model.team;

    
    /**
     *总
     */
    self.totalLabel.text =model.total;
    
    
    /**
     *胜
     */
    self.winLabel.text = model.win;
    
    
    /**
     *平
     */
    self.drawLabel.text = model.draw;
    
    
    
    
    /**
     *负
     */
    self.lossLabel.text = model.loss;
    
    
    
    
    
    /**
     *得
     */
    self.getLabel.text = model.get;
    
    
    /**
     *失
     */
    self.missLabel.text = model.miss;
    
    
    /**
     *净
     */
    self.cleanLabel.text = model.clean;
    /**
     *积分
     */
    self.scoreLabel.text = model.score;
    
      
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
